<template>
    <el-row class="height100 box box-tb box-pack-start">
        <kcqd-jyz :sjData="cousList" ref="sjqd"></kcqd-jyz>
        <!-- <kcqd-tr ref="sjqdTr" v-if="maxRole == `tr`"></kcqd-tr> -->
        <!-- <detail-view :ldsjid="ldsjid" :classid="bj" :dialogVisible="tkzt" @clickClose="clickClose()" ref="child"></detail-view> -->
    </el-row>
</template>

<script>
    import kcqdJyz from './components/kcqdJyz.vue';
    import kcqdTr from './components/kcqdTr.vue';
    export default {
        components: {
            kcqdJyz,
            kcqdTr
        },
        data() {
            return {
                loginInfo: this.$store.state.loginInfo,
                ldsjid: 0,
                sjList: [],
                tkzt: false,
                current: 0,
                stuCnt: 0,
                jyzid: 0,
                schoolid: this.$store.state.schoolId,
                maxRole: this.$store.state.maxRole,
                page: {
                    list: [],
                    pageSize: 1000,
                    pageNum: 1
                },
                cousList:[]
            };
        },
        mounted() {
            this.getJyzData();

            console.log(this.maxRole);
            if (this.maxRole == `tr`) {
                this.$refs.sjqdTr.getXqData();
            } else if (this.maxRole == `admin` ||this.maxRole == `team`||this.maxRole == `team_tr`) {
                // this.$refs.sjqd.getXqData();
                this.$refs.sjqd.getQdList();
            }
        },
        methods: {
            change() {},
            getJyzData() {
                this.$api.Admin.getJyzData({
                    'schoolid': this.schoolid
                }).then(res => {
                    console.log(res);
                    if (res.code == '0') {
                        this.jyzid = res.data;
                        this.$store.commit("setJyzid", res.data);
                        this.listLdkc()
                    }
                })
            },
            xtjyLdsjList() {
                this.$api.jyz.xtjyLdsjList({
                    'jyzid': this.jyzid,
                    'seachText': this.searchText,
                    pageSize: this.page.pageSize,
                    pageNum: this.page.pageNum
                }).then(res => {
                    console.log(res);
                    if (res.code == '0') {
                        this.page = res.list;
                    } else {
                        this.$message.error('请求失败！');
                    }
                })
            },
            listLdkc() {
                this.$api.jyz.xtjyCousList({
                    'jyzid': this.jyzid
                }).then(res => {
                    console.log("=======================");
                    console.log(res);
                    if (res.code == '0') {
                        this.cousList = res.list;
                    } else {
                        this.$message.error('请求失败！');
                    }
                })
            },
            stuLdsjRate() {
                let url = '/yclassldsjtask/sjprocess';
                let params = {
                    xn: this.xqValue.split('-')[0],
                    xq: this.xqValue.split('-')[1].split('（')[0],
                    schoolid: this.loginInfo.user.schoolId,
                    classid: this.bj
                };
                this.$ajax.post(url, params).then(res => {
                    console.log(res);
                    if (res.code == 0) {
                        this.sjList = res.list;
                        this.stuCnt = res.classStuCnt
                    } else {
                        // this.$message.error('请求失败！');
                    }
                })
            },
            changeClass(classid, index) {
                this.current = index;
                this.bj = classid;
                console.log(classid);
                this.listLdkc();
            },
            clickClose() {
                this.tkzt = false
            },
            detail(ldsjid) {
                this.ldsjid = ldsjid;
                this.$refs.child.ldsjStuWcInfo(ldsjid);
                this.tkzt = true
            }
        }
    }
</script>

<style scoped lang="scss">
    .class {
        width: 200px;
        background-color: #fff;
    }

    .class-top {
        padding: 10px 20px;
        border-bottom: 1px solid #EEF4F8;
    }

    .class-list {
        overflow-y: auto;
    }

    .list {
        position: relative;
        padding: 20px;
        height: 113px;
        background: #fff;
        border: 1px solid #E0DEF6;
        border-radius: 7px;

        .icon {
            position: absolute;
            top: 0;
            left: 0;
            display: block;
            width: 114px;
            height: 22px;
            background: #FFF5D9;
            color: #FFA758;
            font-size: 15px;
            border-radius: 7px 0px 0px 0px;
        }

        h3 {
            font-size: 18px;
        }
    }

    .lists {
        box-sizing: border-box;
        position: relative;
        background: #F8F9FC;
        border: 1px solid #ccc;
        border-radius: 6px;

        h3 {
            width: 65%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .icon-2 {
            position: absolute;
            right: 0;
            top: 0;
            display: block;
            width: 114px;
            height: 22px;
            background: #FFF5D9;
            color: #FFA758;
            font-size: 15px;
            border-radius: 7px 0px 0px 0px;
        }
    }

    .pub {
        border: 1px solid #E0DEF6;
        border-radius: 12px;
    }

    .lists.active {
        color: #fff;
        background: #7686F5;
    }

    .maxwidth {
        max-width: 1400px;
        margin: 20px auto !important;
    }

    /deep/ .el-image.img {
        border-radius: 5px;
        width: 120px;
        height: 100px;
    }
</style>
